All Questions
6 questions
3votes
2answers
401views
Count character 'a' in first n characters of indefinitely repeating string s
Problem statement: Lilah has a string, s, of lowercase English letters that she repeated infinitely many times. Given an integer, n, find and print the number of letter a's in the first n ...
5votes
2answers
308views
Counting valleys traversed below sea level, given elevation changes
Problem Statement: Gary is an avid hiker. He tracks his hikes meticulously, paying close attention to small details like topography. During his last hike he took exactly steps. For every step he ...
2votes
1answer
438views
Functional API wrapper written in Scala
I've been working on an small API wrapper for the GitHub API using Scala (full source on GitHub). I'm still very new to the language, so I was hoping to get some feedback about a couple of design ...
2votes
2answers
614views
A Scala Maze Generator in Functional Style
I'm wondering if there is more I can do to incorporate more idiomatic scala and functional programming principles. I know the maze itself is mutable but i didn't see an easy solution to making it ...
5votes
3answers
128views
Generating a game board with squares in a rectangle
I am trying to generate a game board (similar to a Monopoly board). I am new to Scala and am thinking that there may be a better way to do this. But improvements to the code are also welcome. ...
3votes
1answer
191views
Functional SaveObject in Scala
I came across Java like Scala code that I am trying to refactor to make it functional and immutable. The first obvious flaw is that it's violating thread safety by using mutable public class level ...